package cn.wolfcode.wolf2w.uitl;

import cn.wolfcode.wolf2w.uitl.newException.LogiclException;

import java.util.regex.Pattern;

/**
 * 手机格式验证
 */

public class TelVerifyNuil {
    //传入一个号码
    public static void isMobile(String str) {
       // String s2 = "^[1](([3|5|8][\\d])|([4][5,6,7,8,9])|([6][5,6])|([7][3,4,5,6,7,8])|([9][8,9]))[\\d]{8}$";// 验证手机号
        String s2 = "^[1]\\d{10}$";// 验证手机号
        Pattern phone = Pattern.compile(s2);//表达式
        if (!phone.matcher(str).matches()) {
            throw new LogiclException("手机号码格式不正确");
        }
    }
}
